package com.hgkj.cloud.base.service.impl;

import com.hgkj.cloud.base.common.PageInfo;
import com.hgkj.cloud.base.dao.TenantQuestionnaireQuestionMapper;
import com.hgkj.cloud.base.domain.TenantQuestionnaireQuestion;
import com.hgkj.cloud.base.service.TenantQuestionnaireQuestionService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

@Service
public class TenantQuestionnaireQuestionServiceImpl implements TenantQuestionnaireQuestionService {

    @Autowired
    private TenantQuestionnaireQuestionMapper tenantQuestionnaireQuestionMapper;

    @Override
    public int deleteByPrimaryKey(Long id) {
        return tenantQuestionnaireQuestionMapper.deleteByPrimaryKey(id);
    }

    @Override
    public int insert(TenantQuestionnaireQuestion record) {
        return tenantQuestionnaireQuestionMapper.insert(record);
    }

    @Override
    public int insertSelective(TenantQuestionnaireQuestion record) {
        return tenantQuestionnaireQuestionMapper.insertSelective(record);
    }

    @Override
    public TenantQuestionnaireQuestion selectByPrimaryKey(Long id) {
        return tenantQuestionnaireQuestionMapper.selectByPrimaryKey(id);
    }

    @Override
    public int updateByPrimaryKeySelective(TenantQuestionnaireQuestion record) {
        return tenantQuestionnaireQuestionMapper.updateByPrimaryKeySelective(record);
    }

    @Override
    public int updateByPrimaryKey(TenantQuestionnaireQuestion record) {
        return tenantQuestionnaireQuestionMapper.updateByPrimaryKey(record);
    }

    @Override
    public TenantQuestionnaireQuestion getQnQuestionById(Map<String, Object> map) {
        return tenantQuestionnaireQuestionMapper.getQnQuestionById(map);
    }

    @Override
    public List<TenantQuestionnaireQuestion> listAllQnQuestions(PageInfo pi, Map<String, Object> map) {
        if(pi != null){
            map.put("currentCount", pi.getCurrentCount());
            map.put("pageSize", pi.getPageSize());
        }
        return tenantQuestionnaireQuestionMapper.listAllQnQuestions(map);
    }

    @Override
    public long listAllQnQuestionsCount(Map<String, Object> map) {
        return tenantQuestionnaireQuestionMapper.listAllQnQuestionsCount(map);
    }

    @Override
    public List<TenantQuestionnaireQuestion> listQnQuestionAllList(Long questionnaire_id) {
        return tenantQuestionnaireQuestionMapper.listQnQuestionAllList(questionnaire_id);
    }

    @Override
    public int delQnQuestion(Long questionnaire_id) {
        return tenantQuestionnaireQuestionMapper.delQnQuestion(questionnaire_id);
    }

    @Override
    public List<Map<String, Object>> getQUandAnScore(String questionnaire_id) {
        return tenantQuestionnaireQuestionMapper.getQUandAnScore(questionnaire_id);
    }

    @Override
    public Map<String, Object> getQNQuestion(Map<String, Object> map) {
        return tenantQuestionnaireQuestionMapper.getQNQuestion(map);
    }
}
